using System;
using System.ComponentModel;

namespace VSSDKAssist.Recipes.Common.Editors.Grid
{
    /// <summary>
    /// Proxy for siting the designer column
    /// </summary>
    public class SiteProxy : ISite
    {
        ISite realSite;

        /// <summary>
        /// Initializes a new instance of the <see cref="T:SiteProxy"/> class.
        /// </summary>
        /// <param name="realSite">The real site.</param>
        public SiteProxy(ISite realSite)
        {
            this.realSite = realSite;
        }

        #region ISite Members

        /// <summary>
        /// Gets the component associated with the <see cref="T:System.ComponentModel.ISite"></see> when implemented by a class.
        /// </summary>
        /// <value></value>
        /// <returns>The <see cref="T:System.ComponentModel.IComponent"></see> instance associated with the <see cref="T:System.ComponentModel.ISite"></see>.</returns>
        public IComponent Component
        {
            get { return realSite.Component; }
        }

        /// <summary>
        /// Gets the <see cref="T:System.ComponentModel.IContainer"></see> associated with the <see cref="T:System.ComponentModel.ISite"></see> when implemented by a class.
        /// </summary>
        /// <value></value>
        /// <returns>The <see cref="T:System.ComponentModel.IContainer"></see> instance associated with the <see cref="T:System.ComponentModel.ISite"></see>.</returns>
        public IContainer Container
        {
            get { return realSite.Container; }
        }

        /// <summary>
        /// Determines whether the component is in design mode when implemented by a class.
        /// </summary>
        /// <value></value>
        /// <returns>true if the component is in design mode; otherwise, false.</returns>
        public bool DesignMode
        {
            get { return realSite.DesignMode; }
        }

        /// <summary>
        /// Gets or sets the name of the component associated with the <see cref="T:System.ComponentModel.ISite"></see> when implemented by a class.
        /// </summary>
        /// <value></value>
        /// <returns>The name of the component associated with the <see cref="T:System.ComponentModel.ISite"></see>; or null, if no name is assigned to the component.</returns>
        public string Name
        {
            get { return realSite.Name; }
            set { }
        }

        #endregion

        #region IServiceProvider Members

        /// <summary>
        /// Gets the service object of the specified type.
        /// </summary>
        /// <param name="serviceType">An object that specifies the type of service object to get.</param>
        /// <returns>
        /// A service object of type serviceType.-or- null if there is no service object of type serviceType.
        /// </returns>
        public object GetService(Type serviceType)
        {
            return realSite.GetService(serviceType);
        }

        #endregion
    }
}